<template>
	<view class="container">
		<u-navbar title="平武供销社" leftIcon="map" leftText="全国" titleStyle="font-weight: 600;" :fixed="true"
			:placeholder="true" @leftClick="toUrl('/pagesA/pages/map/map')" leftIconColor="#2C8246">
		</u-navbar>
		<u-search placeholder="请输入关键词" v-model="keyword" bgColor="#fff"></u-search>
		<view class="swiper-box">
			<u-swiper :list="banner" indicator height="200" imgMode="widthFix" @click="swiperClick"></u-swiper>
		</view>
		<view class="card-box">
			<view class="card-item" style="width: 50%;" @click="switchTab">
				<view class="item-text">
					<view class="item-name">
						<text class="name">平武蔬菜</text>
						<text class="tips">优质好品</text>
					</view>
					<text class="more">查看全部 ></text>
				</view>
				<image src="http://www.quanyuntong.cn/news2/icon1.jpg" mode="widthFix" class="item-icon"></image>
			</view>
			<view style="flex-direction: column;width: 50%;">
				<view class="card-item" style="flex-direction: row;gap: 20rpx;" @click="switchTab">
					<view class="item-text" style="flex-direction: column;">
						<view class="item-name">
							<text class="name">平武水果</text>
							<text class="tips">优质好品</text>
						</view>
						<text class="more" style="margin-top: 20rpx;">查看全部 ></text>
					</view>
					<image src="http://www.quanyuntong.cn/news2/icon2.jpg" mode="widthFix" class="item-icon"
						style="margin: 0;"></image>
				</view>
				<view class="card-item" style="flex-direction: row;gap: 20rpx;" @click="switchTab">
					<view class="item-text" style="flex-direction: column;">
						<view class="item-name">
							<text class="name">平武生鲜</text>
							<text class="tips">优质好品</text>
						</view>
						<text class="more" style="margin-top: 20rpx;">查看全部 ></text>
					</view>
					<image src="http://www.quanyuntong.cn/news2/icon3.jpg" mode="widthFix" class="item-icon"
						style="margin: 0;"></image>
				</view>
			</view>
		</view>
		<view class="list">
			<view class="list-title">
				<view class="line"></view>
				<text class="title">助农</text>
			</view>
			<view class="list-item" @click="toNews(1)">
				<image src="../../static/news1.jpg" mode="widthFix" class="item-img"></image>
				<view class="item-info">
					<text class="item-title">赵大叔自养蜂蜜</text>
					<text class="item-text">赵大叔居住在平武县宁静的小山村中，这里四周青山环绕，绿树成荫。作为众多留守老</text>
				</view>
			</view>
			<view class="list-item" @click="toNews(2)">
				<image src="../../static/news2.jpg" mode="widthFix" class="item-img"></image>
				<view class="item-info">
					<text class="item-title">孙大姐自种高山土豆</text>
					<text class="item-text">孙大姐是平武县一位勤劳能干的农民，她把自己的心血都倾注在了自家的土地上。平武</text>
				</view>
			</view>
			<view class="list-item" @click="toNews(3)">
				<image src="../../static/news3.jpg" mode="widthFix" class="item-img"></image>
				<view class="item-info">
					<text class="item-title">李大哥散养土鸡鸡蛋</text>
					<text class="item-text">李大哥在平武县的偏远山区经营着一个小型散养鸡场。这里空气清新，水源纯净，为土</text>
				</view>
			</view>
		</view>
		<view class="list">
			<view class="list-title">
				<view class="line"></view>
				<text class="title">公益活动</text>
			</view>
			<image src="http://www.quanyuntong.cn/news2/banner4.jpg" mode="widthFix" class="active" @click="activeClick">
			</image>
		</view>
		<video class="myVideo"
			src="https://vdept3.bdstatic.com/mda-qfddr6fh2xphcuqv/360p/h264/1718358128677966986/mda-qfddr6fh2xphcuqv.mp4?v_from_s=hkapp-haokan-hbf&auth_key=1729163585-0-0-3c02bece1a4f5868b9ad5f7b12770798&bcevod_channel=searchbox_feed&pd=1&cr=0&cd=0&pt=3&logid=0785381364&vid=10667424397610453788&klogid=0785381364&abtest="></video>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				banner: [
					'http://www.quanyuntong.cn/news2/banner1.jpg',
					'http://www.quanyuntong.cn/news2/banner2.jpg',
					'http://www.quanyuntong.cn/news2/banner3.jpg',
				],
			}
		},
		methods: {
			toUrl(url) {
				uni.navigateTo({
					url: url
				})
			},
			activeClick() {
				uni.navigateTo({
					url: '/pagesA/pages/wxWeb/wxWeb'
				})
			},
			toNews(index) {
				uni.navigateTo({
					url: '/pagesA/pages/news/news?index=' + index
				})
			},
			switchTab() {
				uni.switchTab({
					url: '/pages/classify/classify'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		background-color: #F6F6F6;
		padding: 20rpx;
		box-sizing: border-box;
		min-height: 100vh;
	}

	/deep/ .u-navbar {
		width: 100%;
	}

	.swiper-box {
		width: 100%;
		box-sizing: border-box;
		margin-top: 20rpx;
	}

	.card-box {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 20rpx;

		.card-item {
			border-radius: 10rpx;
			background-color: #fff;
			padding: 10rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin: 20rpx 0;
			gap: 30rpx;

			.item-text {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.item-name {
					display: flex;
					flex-direction: column;
					align-items: center;
					gap: 10rpx;

					.name {
						font-size: 28rpx;
						color: #A1C075;
						font-weight: bold;
					}

					.tips {
						font-size: 24rpx;
						color: #FEDADC;
					}
				}

				.more {
					font-size: 24rpx;
					color: #C4C4C6;
				}
			}

			.item-icon {
				width: 100%;
				margin-top: 30rpx;
			}
		}
	}

	.list {
		border-radius: 10rpx;
		background-color: #fff;
		padding: 20rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		margin-bottom: 20rpx;

		.list-title {
			display: flex;
			align-items: center;

			.line {
				width: 12rpx;
				height: 50rpx;
				background-color: #2C8246;
				border-radius: 10rpx;
			}

			.title {
				margin-left: 20rpx;
				font-size: 32rpx;
			}
		}

		.list-item {
			display: flex;
			margin-top: 20rpx;

			.item-img {
				width: 260rpx;
				border-radius: 10rpx;
			}

			.item-info {
				width: 560rpx;
				height: 140rpx;
				margin-left: 30rpx;
				margin-top: 20rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.item-title {
					font-size: 28rpx;
				}

				.item-text {
					font-size: 24rpx;
					color: #C4C4C6;
					margin-top: 20rpx;
					display: -webkit-box;
					/* 将对象作为弹性伸缩盒子模型显示 */
					-webkit-line-clamp: 2;
					/* 显示的行数 */
					-webkit-box-orient: vertical;
					/* 设置或检索伸缩盒对象的子元素的排列方式 */
					overflow: hidden;
					/* 溢出隐藏 */
				}
			}
		}
		
		.active{
			width: 100%;
			border-radius: 20rpx;
			margin-top: 20rpx;
		}
	}

	.myVideo {
		width: 100%;
		height: 500rpx;
		border-radius: 20rpx;
		margin-top: 40rpx;
	}
</style>